#ifndef DEVICES_H
#define DEVICES_H
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/device.h>
#include <linux/fs.h>
#include "rules.h"
#include "log.h"
#include "log.c"
#include "conn_tab.h"
#include "conn_tab.c"

#define RULES_NAME "fw4_rules"		// name of rules device
#define RULES_FILES 2				// files in rules device
#define LOG_NAME "fw4_log"			// name of log device
#define LOG_FILES 2					// files in log device
#define CONN_NAME "fw4_conn_tab"	// name of conn table device
#define CONN_FILES 2				// files in conn table device
#define FW_ATTR_MODE 0666 			// permission mode for device files

/*
 * function r_init
 * entry point of the module
 */ 
static int r_init(void);
/*
 * function r_cleanup
 * exit point of the module
 */ 
static void r_cleanup(void);
/*
 * function config_store
 * saves the congifuration to a global variable fw_config
 */ 
static ssize_t config_store(struct device *dev, struct device_attribute *attr,const char *buf, size_t count);
/*
 * function config_show
 * reads the current configuration
 */ 
static ssize_t config_show(struct device *dev, struct device_attribute *attr,char *buf);
/*
 * function rules_open
 * opens the rules file (default)
 */ 
static int rules_open(struct inode *inode,struct file *filep);
/*
 * function rules_mmap
 * mmaps the rulesPtr array to user space memory
 */ 
static int rules_mmap(struct file *filp, struct vm_area_struct *vma);
/*
 * function rules_size_show
 * copies to buf the size in bytes of max rules entries
 */ 
static ssize_t rules_size_show(struct device *dev, struct device_attribute *attr,char *buf);
/*
 * function log_open
 * opens the log files (default)
 */ 
static int log_open(struct inode *inode,struct file *filep);
/*
 * function log_mmap
 * mmaps the log array to user space memory
 */ 
static int log_mmap(struct file *filp, struct vm_area_struct *vma);
/*
 * function log_size_show
 * copies to buf the size in bytes of max log entries
 */ 
static ssize_t log_size_show(struct device *dev, struct device_attribute *attr,char *buf);
/*
 * function log_clear_store
 * clears the log array given an unsigned int in buf
 */ 
static ssize_t log_clear_store(struct device *dev, struct device_attribute *attr,const char *buf, size_t count);
/*
 * function conn_open
 * opens the connection table file (default)
 */ 
static int conn_open(struct inode *inode,struct file *filep);
/*
 * function conn_mmap
 * mmaps the connection table to user space memory
 */ 
static int conn_mmap(struct file *filp, struct vm_area_struct *vma);
/*
 * function conn_size_show
 * copies to buf the size in bytes of max connection entries
 */ 
static ssize_t conn_size_show(struct device *dev, struct device_attribute *attr,char *buf);
/*
 * function conn_clear_store
 * clears the connection table, given an unsigned int in buf
 */ 
static ssize_t conn_clear_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count);

#endif


